package com.example.myapplication;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;

public class SlideActivity extends AppCompatActivity {
    // 声明控件
    private ImageView mIvHead;
    private SlideMenu slideMenu;
    private Button mBtnBlog;
    private Button mBtnProfile;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_slide);

        // 找到控件
        mIvHead = findViewById(R.id.iv_head);
        slideMenu = findViewById(R.id.slidMenu);
        mBtnBlog = findViewById(R.id.btn_main_1);
        mBtnProfile = findViewById(R.id.btn_main_2);

        // 实现侧滑，点击加侧滑
        mIvHead.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                slideMenu.switchMenu();
            }
        });

        mBtnBlog.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = null;
                intent = new Intent(SlideActivity.this, BlogActivity.class);
                startActivity(intent);
            }
        });

        mBtnProfile.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = null;
                intent = new Intent(SlideActivity.this, ProfileActivity.class);
                startActivity(intent);
            }
        });
    }

}